Alloy.Globals.Map = require('ti.map');

if (!Ti.App.Properties.hasProperty('seeded')) {

    // add all items to collection
    Alloy.Collections.IncidenteDAO.reset([{
        "nombreEmpresa" : "Solventa",
        "nivel": "Critico",
        "detalle": "Contact Center",
        "fecha": "22 Jul 2014 - 12:05",
        "imagenNivel": "/imagen/icon-open.png"
         
    }, {
        "nombreEmpresa" : "Corporativo",
        "nivel": "Critico",
        "detalle": "Correo",
        "fecha": "21 Jul 2014 - 12:05",
        "imagenNivel": "/imagen/icon-open.png"
    }, {
        "nombreEmpresa" : "Oncovida",
        "nivel": "Critico",
        "detalle": "OIS",
        "fecha": "17 Jul 2014 - 12:05",
        "imagenNivel": "/imagen/icon-ok.png"
    }, {
        "nombreEmpresa" : "Sofocar",
        "nivel": "Critico",
        "detalle": "RF",
        "fecha": "10 Jul 2014 - 12:05",
        "imagenNivel": "/imagen/icon-open.png"
    }]);

    // save all of the elements
    Alloy.Collections.IncidenteDAO.each(function(_m) {
        _m.save();
    });

    Ti.App.Properties.setString('seeded', 'yuppers');

}

// force tables to update
Alloy.Collections.IncidenteDAO.fetch();